package com.zb.serviceimpl;

import java.util.List;

import com.zb.dao.UserDao;
import com.zb.daoimpl.UserDaoImpl;
import com.zb.entity.User;
import com.zb.service.UserService;
import com.zb.util.PageUtil;

public class UserServiceImpl implements UserService{
	private UserDao userDao=new UserDaoImpl();
	public PageUtil<User> getUserPage(Integer index) {
		PageUtil<User> page = new PageUtil<User>();
		
		List<User> list = userDao.getUserList(index, page.getSize()
				);
		int count = userDao.getUserCount();

		page.setCount(count);
		page.setData(list);
		page.setIndex(index);
		return page;
	}
		

	public void addUser(User u) {
		// TODO Auto-generated method stub
		userDao.addUser(u);
	}

	public void update(User u) {
		// TODO Auto-generated method stub
		userDao.update(u);
	}

	public void delUser(int id) {
		// TODO Auto-generated method stub
		userDao.delUser(id);
	}

	public User getUserById(int id) {
		// TODO Auto-generated method stub
		return userDao.getUserById(id);
	}

}
